<!---
 @Name: index.vue
 @Author: lhf
 @Owner:
 @Date: 2025-07-15 15:20:27
 @LastEditTime: 2025-07-15 15:20:27
 @LastEditors:lhf
 @Description:  医院信息
 @Version:
 @FilePath: src\views\column\index.vue
--->

<template>
  <div class="container">
    <ul class="list-body" v-show="!show">
      <li class="flex-body" v-for="(item, index) in lists" @click="toggleInfo(item)" :key="index">
        <div class="list-title">{{ item.name || '' }}</div>
        <span>{{ toDate(item.updateTime) }}</span>
      </li>
    </ul>
    <bese-column />
  </div>
</template>

<script>
import { getProgramInfo } from '@/api';
export default {
  name: 'HelloWorld',
  props: {
    programId: String
  },
  components: {},
  data() {
    return {
      lists: []
    };
  },
  computed: {
    show() {
      return this.$store.getters.show;
    }
  },
  mounted() {
    this.getProgramInfos();
  },
  methods: {
    toDate(str) {
      str = str || '';
      if (str === '') return;
      return str.replace(/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/, '$1-$2-$3');
    },
    toggleInfo(row) {
      const { content = '' } = row || {};
      if (!content || content === '') return;
      this.$store.commit('SET_INFO', content);
      this.$store.commit('SET_SHOW', true);
    },
    getProgramInfos() {
      getProgramInfo({
        programId: this.programId
      }).then((res) => {
        if (res.status == 0) {
          this.lists = [...res.data, ...res.data, ...res.data] || [];
        }
      });
    }
  }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="scss">
.container {
  height: 100%;
  border-radius: 20px;
  line-height: 1.5;
  text-align: justify;
  overflow: hidden;
  word-break: break-word;
  font-size: 28px;
  .list-body {
    height: 100%;
    overflow-y: auto;
    li {
      height: 142px;
      line-height: 142px;
      background: #fff;
      font-weight: 500;
      font-size: 50px;
      color: #333;
      padding: 0 65px;
      span {
        width: 380px;
        display: inline-block;
        vertical-align: top;
        text-align: right;
      }
      div {
        flex: 1;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      &:nth-child(2n) {
        background: #f8f8f8;
      }
    }
  }
}
</style>
